using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;

namespace Legend.Fakes
{
    public class ArgumentList
        : IEnumerable<object>
    {
        private readonly object[] arguments;

        [DebuggerStepThrough]
        public ArgumentList(object[] arguments)
        {
            this.arguments = arguments;
        }

        public object this[int argumentIndex]
        {
            [DebuggerStepThrough]
            get
            {
                return this.arguments[argumentIndex];
            }
        }

        [DebuggerStepThrough]
        public IEnumerator<object> GetEnumerator()
        {
            return this.arguments.Cast<object>().GetEnumerator();
        }

        [DebuggerStepThrough]
        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return this.arguments.GetEnumerator();
        }

        public int Count
        {
            [DebuggerStepThrough]
            get
            {
                return this.arguments.Length;
            }
        }

        public static ArgumentList Empty
        {
            [DebuggerStepThrough]
            get
            {
                return new ArgumentList(new object[] { });
            }
        }
    }
}